import 'package:flutter/material.dart';
import 'package:aweb5/base/BaseWidget.dart';
import 'package:aweb5/pages/ReceiveAddress.dart';
class SelectAddress extends BaseWidget {
  @override
  State<SelectAddress> createState() => SelectAddressState();
}

class SelectAddressState extends BaseWidgetState<SelectAddress> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    init(context);
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: appBarWithBack("选择地址"),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          top(),
          Container(
            color: Color(0xfff4f4f4),
            height: 10,
          ),
          Expanded(
              child: ListView.builder(
                  itemCount: 10,
                  itemBuilder: (con, ind) {
                    return item();
                  })),
        ],
      ),
      bottomSheet: Container(
        height: 69,
        child: Column(
          children: <Widget>[
            Container(
              height: 1,
              color: Color(0xffe9e9e9),
            ),
            Container(
              alignment: Alignment.center,
              color: Colors.white,
              height: 68,
              child: InkWell(
                child: Container(
                  padding:
                      EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(10),
                      border: Border.all(color: Color(0xff4f4f4f))),
                  child: Text(
                    "管理地址",
                    style: TextStyle(color: Color(0xff4f4f4f), fontSize: 12),
                  ),
                ),
                onTap: (){
                  navigatorState.push(new MaterialPageRoute(builder: (con){
                    return ReceiveAddress();
                  }));
                },
              ),
            )
          ],
        ),
      ),
    );
  }

  Widget top() {
    return Container(
      padding: EdgeInsets.only(left: 10, top: 10, bottom: 10, right: 10),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Row(
            children: <Widget>[
              Text(
                "[默认地址]",
                style: TextStyle(color: Color(0xffFF8900), fontSize: 14),
              ),
              SizedBox(
                width: 8,
              ),
              Text("陈某某",
                  style: TextStyle(color: Color(0xff2d2d2d), fontSize: 14)),
              SizedBox(
                width: 8,
              ),
              Text("18787876789",
                  style: TextStyle(color: Color(0xff2d2d2d), fontSize: 14)),
            ],
          ),
          SizedBox(
            height: 15,
          ),
          Text("北京 北京市 平谷区 北京市平谷区紫贵庄园9-10号",
              style: TextStyle(color: Color(0xff2d2d2d), fontSize: 13))
        ],
      ),
    );
  }

  Widget item() {
    return Column(
      children: <Widget>[
        Container(
          padding: EdgeInsets.only(left: 10, top: 10, bottom: 10, right: 10),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Row(
                children: <Widget>[
                  Text("陈某某",
                      style: TextStyle(color: Color(0xff2d2d2d), fontSize: 14)),
                  SizedBox(
                    width: 8,
                  ),
                  Text("18787876789",
                      style: TextStyle(color: Color(0xff2d2d2d), fontSize: 14)),
                ],
              ),
              SizedBox(
                height: 15,
              ),
              Text("北京 北京市 平谷区 北京市平谷区紫贵庄园9-10号",
                  style: TextStyle(color: Color(0xff2d2d2d), fontSize: 13))
            ],
          ),
        ),
        Container(
          height: 1,
          color: Color(0xffe9e9e9),
        )
      ],
    );
  }
}
